<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>stock_calc</title>
    <script src="../jquery-1.7.2.js"></script>
</head>
<body>
<style>
    ui,li {
        padding: 0;
        margin: 0;
        margin-top: 10px;
        list-style: none;
    }
</style>
<h5>复利计算投资收益</h5>
<ul>
    <li>
        <input type="text" class="begin">

    </li>
    <li>
        <input type="text" class="interest_rate">
    </li>
    <li>
        <input type="text" class="interest_n" value="1">
    </li>
    <li>
        <input type="button" class="calc" value="点击计算">

    </li>
</ul>
<span class="result"></span>

<script>
$(function(){
    $('.calc').click(function(){
        var begin = parseFloat($('.begin').val());
        var interest_rate = parseFloat($('.interest_rate').val());
        var n =  parseFloat($('.interest_n').val());
        var sum = begin*(1+interest_rate);

        $('.result').html(sum);
    })
})
</script>
</body>
</html>